<template>
    <div>
        <table>
            <tr>
                <td>编号</td>
                <td>
                    <input type="text" v-model="data.bh">
                </td>
            </tr>
       
            <tr>
                <td>名称</td>
                <td>
                    <input type="text" v-model="data.mc">
                </td>
            </tr>
            <tr>
                <td>楼层</td>
                <td>
                    <select v-model="data.louc">
                        <option value="3层">3层</option>
                        <option value="4层">4层</option>
                        <option value="5层">5层</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td></td>
                <td>
                    <input type="button" value="修改" @click="dl">
                </td>
            </tr>
        </table>

    </div>
</template>

<script setup lang="ts">
import axios from 'axios';
import { ref,onMounted } from 'vue';
import { useRoute, useRouter } from 'vue-router';
const rote = useRouter()
const rotes = useRoute()
const data=ref({
    "id": 5,
  "bh": "hb2323424",
  "mc": "黄金甲",
  "louc": "3层"
})
onMounted(()=>{
    ftte();
})

const dl=()=>{
    axios.post("https://localhost:7219/api/we/update",data.value).then(res=>{
        if(res.data>0){
            alert("修改成功")
            location.href="/xs"
        }else{
            alert("修改失败")
        }
    })
}
const ftte=()=>{
    debugger
    var vid= rotes.query.id;

    axios.get("https://localhost:7219/api/we/xss",{params:{id:vid}}).then(res=>{
        data.value= res.data;
    })
}

</script>

<style scoped>

</style>